<% layout("/inc/layout.html"){ %>
<% layout("/user/left_user.html"){}%>

<div class="am-u-sm-9">
<div class="dataTables_wrapper no-footer">
<table class="table table-border table-bordered table-bg table-striped table-hover">
	<thead>
		<tr class="text-c">
			<th width="40">ID</th>
			<th width="100">评论时间</th>
			<th>评论内容</th>
			<th width="60">状态</th>
			<th width="110">操作</th>
		</tr>
	</thead>
	<tbody>
	<% for(obj in list){ %>
		<tr class="text-c">
			<td>${obj.id}</td>
			<td>${obj.createTime}</td>
			<td>${obj.content}</td>
			<td class="td-status">
			  ${obj.state==2?"<span class='label label-success radius'>已回复</span>":"<span class='label radius'>未回复</span>"}
			</td>
			<td class="td-manage">
				<a class="btn btn-secondary size-MINI" href="javascript:;" title="查看" onclick="list_edit('${obj.id}')"><i class="Hui-iconfont">&#xe6df;</i> 查看</a> 
				<a class="btn btn-danger size-MINI" href="javascript:;" title="删除" onclick="list_del('${obj.id}')"><i class="Hui-iconfont">&#xe6e2;</i> 删除</a>
			</td>
		</tr>
	<% } %>
	</tbody>
</table>
</div>
 <script type="text/javascript">
function list_del(id){
	var select_ids = "";
	if(id){
		select_ids=id;
	}else{
	    $("input[name='table_checkbox_id']:checked").each(function(){
	    	select_ids+=$(this).val()+",";   
	    });
	    if(""==select_ids){
	    	layer.msg('请先选择要删除的数据！', {icon: 3,offset: '45px'});
	    	return false;
	    }
	}
	layer.confirm('确认删除所选记录?', {icon: 3, title:'警告'}, function(index){	    
	    layer.close(index);
	    HtmlRender("${BASE}/cms/guestbook/del",{ids:select_ids});
	});
}
function list_edit(id,state){
    HtmlRender("${BASE}/cms/guestbook/edit",{id:id});
}
function list_search(){
	var $form = $("#form_pager_search");
	var url = $form.attr('action');
	var $input  = $("<input type='hidden' name='_sbtn' value='true' />");
	$form.append($input);
    HtmlRender(url,$form.serializeArray());
}
function list_changeSize(size){
	$("#form_pager_search > [name='_p_pageSize']").val(size);
	var $form = $("#form_pager_search");
	var url = $form.attr('action');
    HtmlRender(url,$form.serializeArray());
}

$(function(){
	table_checkbox_all();
})
function list_setState(id,state){
	HtmlRender("${BASE}/cms/guestbook/setState",{id:id,state:state});
}
</script>
</div>
<%}%>
